Skip to content

feat(ecmascript): PlainTime.prototype.since + until#981

Draft
0Zeno wants to merge 1 commit intotrynova:mainfrom
jesperkha:temporal/plaintime-prototype-until-since
Draft

feat(ecmascript): PlainTime.prototype.since + until#981
0Zeno wants to merge 1 commit intotrynova:mainfrom
jesperkha:temporal/plaintime-prototype-until-since

Conversation

@0Zeno
Copy link
Copy Markdown
Contributor

@0Zeno 0Zeno commented Apr 14, 2026

No description provided.

// a. If item has an [[InitializedTemporalTime]] internal slot, then
if let Ok(time) = TemporalPlainTime::try_from(item) {
// i. Let resolvedOptions be ? GetOptionsObject(options).
let resolved_options = get_options_object(agent, options, gc.reborrow()).unbind()?;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue: GC can happen on this line and the line below: that would invalidate time. This shouldn't even pass compilation since item should be correctly bound here.

Comment thread nova_vm/src/ecmascript/builtins/temporal/plain_time.rs Outdated
Comment thread nova_vm/src/ecmascript/builtins/temporal/plain_time.rs
// 1. Set other to ? ToTemporalTime(other).
let other = to_temporal_time(agent, other.unbind(), gc.reborrow());
// 2. Let resolvedOptions be ? GetOptionsObject(options).
let resolved_option = get_options_object(agent, options.get(agent), gc.nogc())
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick: You can take options here.

@aapoalas aapoalas changed the title echmascript(temporal): PlainTime.prototype.since + until feat(ecmascript): PlainTime.prototype.since + until Apr 14, 2026
@0Zeno 0Zeno force-pushed the temporal/plaintime-prototype-until-since branch from 21b0e9e to 1e33056 Compare April 19, 2026 13:38
unsafe {
plain_time = scoped_instant.take(agent);
// 1. If options is not present, set options to undefined.
let options = options.unwrap_or(Value::Undefined);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue: Missing bind call here.

if let Ok(item) = Object::try_from(item) {
// a. If item has an [[InitializedTemporalTime]] internal slot, then
if let Ok(time) = TemporalPlainTime::try_from(item) {
// i. Let resolvedOptions be ? GetOptionsObject(options).
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue: time is invalidated by get_temporal_overflow_option call and would need to be scoped to avoid that problem: better choice is to just get the inner_plain_time value out and store it on the stack here at the entry point of this branch, and return it after we've called get_temporal_overflow_option. A temporal_rs::PlainTime on the stack does not care one whit about / cannot be invalidated by GC.

// a. If item has an [[InitializedTemporalTime]] internal slot, then
if let Ok(time) = TemporalPlainTime::try_from(item) {
// i. Let resolvedOptions be ? GetOptionsObject(options).
let resolved_options = get_options_object(agent, options, gc.nogc()).unbind()?;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue: Missing .bind() call after .unbind()?.

// d. Let result be ? ToTemporalTimeRecord(item).
let result = to_temporal_time_record(agent, item.unbind(), gc.reborrow()).unbind()?;
// e. Let resolvedOptions be ? GetOptionsObject(options).
let resolved_options = get_options_object(agent, options, gc.nogc()).unbind()?;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue: Missing .bind() call after .unbind()?.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants